<?php
include '../class/Uploader.class.v.php';
$config = array(
    "savePath" => '/databak/images/'.$_SESSION['account'],
    "maxSize" => 1024*10, //单位KB
    "allowFiles" => array(".gif", ".png", ".jpg", ".jpeg", ".bmp")
);
// echo $config['savePath'];
$index = $_REQUEST['upload_mth'];
$up = new Uploader("upfile", $config);
$info = $up->getFileInfo();
if($info['state']=='SUCCESS') {
    $path = $up->smart_resize_image(600,365);
    $path = str_replace('/databak/images/', 'http://images.12301.cc/', $path);
    $title = $info['originalName'];
    $srcipt = <<< HTML
    <script>
    parent.jQuery("input.thumb_img").eq($index).val('{$path}');
    parent.jQuery("img.preview").eq($index).attr('src','$path').attr('title','$title');
    parent.jQuery("img.lnk_prv").eq($index).attr('href','$path');
    parent.jQuery('.waitingUpload').eq($index).empty().text('上传成功！');
    </script>
HTML;
}else {
    $srcipt = "<script>alert('".$info['state']."');parent.$('#waitingUpload').empty().text('".$info['state']."');</script>";
}
echo $srcipt;